<?php
/**
 * 产品包装尺寸模型
 * (model)
 */
namespace App\Models\Product;

use Illuminate\Database\Eloquent\Model;

class ProductPacking extends Model
{
    protected $table = 'product_packing';

    protected $guarded = [];

    public $timestamps = false;

    public function sku(){
        return $this->belongsTo(ProductSku::class,'psku_id');
    }

    /**
     * 获取产品发货重量
     * @param $pSkuId
     * @return int
     */
    public static function getShipWeight($pSkuId){
        $shipWeight = self::query()->where('psku_id',$pSkuId)->value('ship_weight');
        return $shipWeight ?: 0;
    }
}
